package com.solution.admin.report.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.solution.admin.report.entity.CustomerAreaDistributionEntity;
import com.solution.admin.report.entity.CustomerGenderDistributionEntity;
import com.solution.admin.report.service.CustomerAreaDistributionService;
import com.solution.admin.report.service.CustomerGenderDistributionService;

/**
 * 客户属性分析报表控制层
 * @author: solin
 * @date: 2018年1月3日 下午2:46:36
 */
@RequestMapping("/report")
@Controller
public class CustomerPropertyAnalysisController {
	private Logger logger = LoggerFactory.getLogger(CustomerPropertyAnalysisController.class);
	@Autowired
	private CustomerGenderDistributionService customerGenderDistributionService;
	@Autowired
	private CustomerAreaDistributionService customerAreaDistributionService;
	
	/**
	 * 跳转到客户属性分析页面
	 * @param request
	 * @return
	 * @author: solin
	 * @date: 2018年1月3日 下午2:51:54
	 */
	@RequestMapping("/toCustomerPropertyAnalysisPage")
	public String toCustomerPropertyAnalysisPage(HttpServletRequest request) {
		return "report/customerPropertyAnalysis";
	}
	
	/**
	 * 获取客户性别分布数据
	 * @param request
	 * @return
	 * @author: solin
	 * @date: 2018年1月4日 上午10:05:26
	 */
	@RequestMapping("/getCustomerGenderDistributionList")
	@ResponseBody
	public List<CustomerGenderDistributionEntity> getCustomerGenderDistributionList(HttpServletRequest request) {
		return customerGenderDistributionService.getCustomerGenderDistributionList();
	}
	
	/**
	 * 获取客户城市分布数据
	 * @param request
	 * @param provinceCode
	 * @return
	 * @author: solin
	 * @date: 2018年1月4日 上午10:19:11
	 */
	@RequestMapping("/getCustomerCityDistributionList")
	@ResponseBody
	public List<CustomerAreaDistributionEntity> getCustomerCityDistributionList(HttpServletRequest request, String provinceCode) {
		return customerAreaDistributionService.getCustomerCityDistributionList(provinceCode);
	}
	
	/**
	 * 获取客户省份分布数据
	 * @param request
	 * @param provinceCode
	 * @return
	 * @author: solin
	 * @date: 2018年1月4日 上午10:19:11
	 */
	@RequestMapping("/getCustomerProvinceDistributionList")
	@ResponseBody
	public List<CustomerAreaDistributionEntity> getCustomerProvinceDistributionList(HttpServletRequest request, String provinceCode) {
		return customerAreaDistributionService.getCustomerProvinceDistributionList(provinceCode);
	}
}
